package com.sdx.console.answer.entity;

import java.util.Date;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;

import com.fasterxml.jackson.annotation.JsonIgnore;
import org.beetl.sql.core.annotatoin.ColumnIgnore;
import org.beetl.sql.core.annotatoin.AutoID;
import org.beetl.sql.core.annotatoin.SeqID;
import org.apache.commons.lang3.StringUtils;
import com.ibeetl.admin.core.util.ValidateConfig;
import com.sdx.service.ConfigService;

import org.beetl.sql.core.TailBean;
import java.math.*;

import com.ibeetl.admin.core.annotation.Dict;
import com.ibeetl.admin.core.entity.BaseEntity;

import org.beetl.sql.core.annotatoin.InsertIgnore;
import org.beetl.sql.core.annotatoin.Version;
import org.beetl.sql.core.annotatoin.LogicDelete;
import com.sdx.common.utils.Utils;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;

/* 
* 
* gen by Spring Boot2 Admin 2019-03-23
*/
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
@Data
public class QaAnswer extends BaseEntity{

    //回答ID
    @NotNull(message = "ID不能为空", groups =ValidateConfig.UPDATE.class)
    @AutoID	
    private Long answerId ;
	
    //问题ID
    private Long questionId ;
	
    //邀请回答ID[回答来自于邀请]
    private String inviteId ;
	
    //回答内容
    private String answerContent ;
	
    //附件
    private String file ;
	
    //点赞数
    private Long praiseCount ;
	
    //评论数
    private Long commentCount ;
	
    //回答者
    private String customerId ;
	
    //是否推荐
    private Integer isTop ;
	
    //创建时间
    private Date createTime ;

    //问题标签
    @ColumnIgnore
    private  String  questionTitle;

    //问答者
    @ColumnIgnore
    private  String  customerName;

    //邀请问答者
    @ColumnIgnore
    private  String  inviteName;

    private Integer provinceId;

    private Date startTime;

    private Date endTime;

    private String createdTimeQuery;

    public void setCreatedTimeQuery(String createdTimeQuery) {
        this.createdTimeQuery = createdTimeQuery;
        Date[] timePair = Utils.parseQueryTime(createdTimeQuery);
        if (timePair!=null && timePair[0]!=null) {
            this.startTime = timePair[0];
        }
        if (timePair!=null && timePair.length==2 && timePair[1]!=null) {
            this.endTime = timePair[1];
        }
    }
}
